package com.tc.vms.consumer;

import com.tc.vms.utils.VmsDomainAttr;

import java.util.Objects;
import java.util.Properties;

/**
 * Created by yonghua.zhang on 2016/6/15.
 */
public final class DlqQueueMetaData extends QueueMetaData {
    private final String dlqQueueNmOnBroker;

    public DlqQueueMetaData(VmsDomainAttr belongAttr, String queueName, String clientId, Properties props) {
        super(belongAttr, queueName, clientId, props);
        this.dlqQueueNmOnBroker = super.getDLQName();
    }

    @Override
    public String getRealQueueNmOnBroker() {
        return dlqQueueNmOnBroker;
    }

    @Override
    public boolean isDlqQueueMetaData() {
        return true;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        if (!super.equals(o))
            return false;
        DlqQueueMetaData that = (DlqQueueMetaData) o;
        return Objects.equals(dlqQueueNmOnBroker, that.dlqQueueNmOnBroker) && Objects
                .equals(super.consumerInstName, that.consumerInstName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), dlqQueueNmOnBroker);
    }

    @Override
    public String toString() {
        return "DlqQueueMetaData{" +
                "dlqQueueNmOnBroker='" + dlqQueueNmOnBroker + '\'' +
                "} " + super.toString();
    }
}
